package com.shangxia.dog.controller;


import com.shangxia.dog.commom.pojo.ResultVO;
import com.shangxia.dog.pojo.vo.LoginAdmin;
import com.shangxia.dog.service.IAdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author shangxia
 * @since 2022-01-16
 */
@Api(tags = "LoginController")
@RestController
@RequestMapping("/")
public class LoginController {

    @Autowired
    private IAdminService adminService;

    @ApiOperation(value = "登录之后返回token")
    @PostMapping("/login")
    public ResultVO<String> login(LoginAdmin loginAdmin, HttpServletRequest request) {
        return adminService.login(loginAdmin.getUsername(), loginAdmin.getPassword(), request);
    }

}
